<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
   var oDate=new Date();
   oDate.setDate(oDate.getDate()+14);//14天后过期
   document.cookie='user=blue; expires='+oDate;//expires  有效期
        alert(document.cookie);

    </script>
</head>
<body>

</body>
</html>